package file;

import java.io.File;

public class DeleteDemo {
    public static void main(String[] args) {
        for (int i = 1;i<=10;i++) {
            File file = new File("./test"+i+".txt");
            if (file.exists()){
                //只能删除一个空目录
                file.delete();
                System.out.println("该文件已删除");
            }else {
                System.out.println("该文件不存在");
            }
        }
        }
}
